package com.freecloud.whispered.system.feign;

import com.freecloud.whispered.system.entity.SysConfigEntity;
import com.freecloud.whispered.system.service.SysConfigCall;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import static com.freecloud.framework.constant.Constant.CLOUD_APP_NAME_SYTEM;


/**
 * @Author: maomao
 * @Date: 2019-08-02 16:29
 */
@FeignClient(value = CLOUD_APP_NAME_SYTEM)
public interface SysConfigFeign extends SysConfigCall {

    @Override
    @PostMapping("/feign/sys/config/queryObjectByKey")
    SysConfigEntity queryObjectByKey(@RequestParam("key") String key);

    @Override
    @PostMapping("/feign/sys/config/updateValueByKey")
    void updateValueByKey(@RequestParam("key")String key, @RequestParam("value") String value);

    @Override
    @PostMapping("/feign/sys/config/getConfigObject")
    <T> T getConfigObject(@RequestParam("key") String key,@RequestParam("clazz") Class<T> clazz);


    @Override
    @PostMapping("/feign/sys/config/getValue")
    String getValue(@RequestParam("key") String key,@RequestParam("defaultValue") String defaultValue);
}
